//package org.com.app.knock.fragment;
//
//import java.util.HashMap;
//import java.util.Iterator;
//import java.util.Map;
//import java.util.Set;
//
//import org.apache.http.HttpResponse;
//import org.apache.http.client.ResponseHandler;
//import org.apache.http.client.methods.HttpPost;
//import org.apache.http.entity.StringEntity;
//import org.apache.http.impl.client.BasicResponseHandler;
//import org.apache.http.impl.client.DefaultHttpClient;
//import org.json.JSONException;
//import org.json.JSONObject;
//
//import z.lib.base.BaseFragment;
//import z.lib.base.BaseUtils;
//import z.lib.base.CommonAndroid;
//import z.lib.base.LogUtils;
//import z.lib.base.callback.RestClient;
//import android.os.AsyncTask;
//import android.os.StrictMode;
//import android.view.View;
//
//import com.knock.app.R;
//
//public class DefaultFragment extends BaseFragment {
//	View views;
//	private static final String LIST_FRAGMENT_TAG = "list_fragment";
//	public DefaultFragment() {
//		super();
////		try {
////			MediaPlayer mPlayer = MediaPlayer.create(getActivity(), R.raw.tap_message);
////			mPlayer.setVolume(0.9f, 0.9f);
////	        mPlayer.start();
////	        mPlayer.setOnCompletionListener(new OnCompletionListener() {
////	            @Override
////	            public void onCompletion(MediaPlayer mPlayer) {
////	            	mPlayer.release();
////	            }
////	        });
////		} catch (Exception e) {
////			// TODO Auto-generated catch block
////			e.printStackTrace();
////		}
//		
//		
//	}
//
//	@Override
//	public int getLayout() {
//		return R.layout.main;
//	}
//
//	@Override
//	public void onClick(View v) {
//		super.onClick(v);
//		int idView = v.getId();
//		LogUtils.e("kkkkkkkkkk","kkkkkkk1");
//		switch (idView) {
//		case R.id.next:
//			startFragment(new MainUser_oldFragment(), null);
//			break;
//		default:
//			break;
//		}
//	}
//
//	@Override
//	public void init(View view) {
//		this.views = view;
//		CommonAndroid.getView(view, R.id.next).setOnClickListener(this);
//		/*CommonAndroid.getView(view, R.id.button_submit).setOnClickListener(this);
//		CommonAndroid.getView(view, R.id.button_reset).setOnClickListener(this);*/
////		BaseUtils.playMedia(getActivity(),R.raw.register);
//		
////		params.put("age", 29);
//		//test
//		final String BASESERVER = "http://pgcafe.asia/samuraistation-clone/api/auth/login";
//		try {
////			if (android.os.Build.VERSION.SDK_INT > 9) {
////			StrictMode.ThreadPolicy policy = 
////			        new StrictMode.ThreadPolicy.Builder().permitAll().build();
////			StrictMode.setThreadPolicy(policy);
////			}
////			HttpResponse abc = makeRequest(BASESERVER,params);
////			LogUtils.e("login",abc.toString());
//		    
//			new AsyncTask<String, String, String>() {
//				@Override
//				protected void onPostExecute(String result) {
//					super.onPostExecute(result);
////					LogUtils.e("login",result.toString());
//				}
//
//				@Override
//				protected String doInBackground(String... paramStrs) {
//					Map<String, Object> params = new HashMap<String, Object>();
//					Map<String, Object> params1 = new HashMap<String, Object>();
//					Map<String, Object> params2 = new HashMap<String, Object>();
////					params.put("req[param][user_id]", "123");
////					params.put("req[lang]", "en");
//					params2.put("user_id", "123141210E");
//					params2.put("password", "1234567a");
//					
//					params1.put("param", params2);
//					params.put("req", params1);
//					DefaultHttpClient httpclient = new DefaultHttpClient();
//
//				    //url with the post data
//				    HttpPost httpost = new HttpPost(BASESERVER);
//
//				    //convert parameters into JSON object
//				    JSONObject holder;
//					try {
//						holder = getJsonObjectFromMap(params);
//					
//				    LogUtils.e("aa","holder=="+ holder.toString());
//
//				    //passes the results to a string builder/entity
//				    StringEntity se = new StringEntity(holder.toString());
//
//				    //sets the post request as the resulting string
//				    httpost.setEntity(se);
//				    //sets a request header so the page receving the request
//				    //will know what to do with it
//				    httpost.setHeader("Accept", "application/json");
//				    httpost.setHeader("Content-type", "application/json");
//
//				    //Handles what is returned from the page 
//				    ResponseHandler responseHandler = new BasicResponseHandler();
//				    httpclient.execute(httpost, responseHandler);
//					} catch (Exception e) {
//						// TODO Auto-generated catch block
//						e.printStackTrace();
//					}
//					return null;
//				}
//			}.execute("");
//		} catch (Exception e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
//	}
//	
//	@SuppressWarnings({ "unchecked", "unchecked" })
//	public static HttpResponse makeRequest(String path, Map params) throws Exception 
//	{
//	    //instantiates httpclient to make request
//	    DefaultHttpClient httpclient = new DefaultHttpClient();
//
//	    //url with the post data
//	    HttpPost httpost = new HttpPost(path);
//
//	    //convert parameters into JSON object
//	    JSONObject holder = getJsonObjectFromMap(params);
//	    LogUtils.e("aa","holder=="+ holder.toString());
//
//	    //passes the results to a string builder/entity
//	    StringEntity se = new StringEntity(holder.toString());
//
//	    //sets the post request as the resulting string
//	    httpost.setEntity(se);
//	    //sets a request header so the page receving the request
//	    //will know what to do with it
//	    httpost.setHeader("Accept", "application/json");
//	    httpost.setHeader("Content-type", "application/json");
//
//	    //Handles what is returned from the page 
//	    ResponseHandler responseHandler = new BasicResponseHandler();
//	    return httpclient.execute(httpost, responseHandler);
//	}
//	
//	private static JSONObject getJsonObjectFromMap(Map params) throws JSONException {
//
//	    //all the passed parameters from the post request
//	    //iterator used to loop through all the parameters
//	    //passed in the post request
//	    Iterator iter = params.entrySet().iterator();
//
//	    //Stores JSON
//	    JSONObject holder = new JSONObject();
//
//	    //using the earlier example your first entry would get email
//	    //and the inner while would get the value which would be 'foo@bar.com' 
//	    //{ fan: { email : 'foo@bar.com' } }
//
//	    //While there is another entry
//	    while (iter.hasNext()) 
//	    {
//	        //gets an entry in the params
//	        Map.Entry pairs1 = (Map.Entry)iter.next();
//
//	        //creates a key for Map
//	        String key1 = (String)pairs1.getKey();
//
//	        //Create a new map
//	        Map m1 = (Map)pairs1.getValue();   
//
//	        //object for storing Json
//	        JSONObject data1 = new JSONObject();
//
//	        //gets the value
//	        Iterator iter2 = m1.entrySet().iterator();
//	        while (iter2.hasNext()) 
//	        {
//	            Map.Entry pairs2 = (Map.Entry)iter2.next();
//	            //---------------
//	          //creates a key for Map
//		        String key12 = (String)pairs2.getKey();
//
//		        //Create a new map
//		        Map m12 = (Map)pairs2.getValue();   
//
//		        //object for storing Json
//		        JSONObject data12 = new JSONObject();
//
//		        //gets the value
//		        Iterator iter22 = m12.entrySet().iterator();
//		        while (iter22.hasNext()) 
//		        {
//		        	Map.Entry pairs22 = (Map.Entry)iter22.next();
//		        	data12.put((String)pairs22.getKey(), (String)pairs22.getValue());
//		        }
//	            //---------------
//	            data1.put((String)pairs2.getKey(),data12 /*(String)pairs2.getValue()*/);
//	        }
//
//	        //puts email and 'foo@bar.com'  together in map
//	        holder.put(key1, data1);
//	    }
//	    return holder;
//	}
//
//	@Override
//	public void onChangeLanguage() {
//		// TODO Auto-generated method stub
//		
//	}
//
//}